import 'package:flutter/material.dart';

class ScheduleBox extends StatelessWidget {
  ScheduleBox(
      {required this.content,
      required this.date,
      required this.outfitName,
      required this.aiSuggestion});

  final String content;
  final String date;
  final String outfitName;
  final String aiSuggestion;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        showDialog(
          context: context,
          builder: (BuildContext context) {
            return AlertDialog(
              shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(20),
                side: BorderSide(color: Colors.indigo, width: 3),
              ),
              backgroundColor: Colors.white,
              title: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    '详细信息',
                    style: TextStyle(
                      color: Colors.black,
                      fontSize: 24.0,
                    ),
                  ),
                  TextButton(
                    child: Icon(
                      Icons.cancel_outlined,
                      color: Colors.black54,
                      size: 40,
                    ),
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                  ),
                ],
              ),
              content: Container(
                height: MediaQuery.of(context).size.height - 500,
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: [
                    Expanded(
                      flex: 2,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            date,
                            style: TextStyle(color: Colors.black, fontSize: 18),
                          ),
                          Text(
                            '搭配: ' + outfitName,
                            style: TextStyle(color: Colors.black, fontSize: 18),
                          ),
                          Text(
                            '内容: ' + content,
                            softWrap: true,
                            style: TextStyle(color: Colors.black, fontSize: 18),
                          ),
                        ],
                      ),
                    ),
                    Expanded(
                      flex: 4,
                      child: Container(
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(25),
                            border: Border.all(color: Colors.black, width: 3)),
                        padding: EdgeInsets.symmetric(horizontal: 25),
                        child: Center(
                          child: ListView(
                            children: [
                              Center(
                                  child: Text(
                                'AI建议',
                                style: TextStyle(
                                    color: Colors.black, fontSize: 22),
                              )),
                              Text(
                                '$aiSuggestion',
                                softWrap: true,
                                style: TextStyle(
                                    color: Colors.black, fontSize: 16),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            );
          },
        );
      },
      child: Container(
        height: 160,
        margin: EdgeInsets.only(top: 25, right: 30, left: 30),
        decoration: BoxDecoration(
          boxShadow: [
            BoxShadow(
              color: Colors.black.withOpacity(0.2), // 阴影颜色和透明度
              spreadRadius: 2, // 阴影扩展半径
              blurRadius: 5, // 阴影模糊半径
              offset: Offset(0, 5), // 阴影偏移量
            ),
          ],
          color: Colors.white,
          borderRadius: BorderRadius.circular(25),
        ),
        child: Row(
          children: [
            Expanded(
              child: Icon(
                Icons.accessibility_new_outlined,
                size: 65,
              ),
            ),
            Expanded(
              flex: 2,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    date,
                    style: TextStyle(color: Colors.black, fontSize: 20),
                  ),
                  Text(
                    '搭配: ' + outfitName,
                    style: TextStyle(color: Colors.black, fontSize: 18),
                  )
                ],
              ),
            ),
            Expanded(
              flex: 2,
              child: Container(
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.circular(25),
                    border: Border.all(color: Colors.black, width: 3)),
                padding: EdgeInsets.symmetric(horizontal: 10),
                child: Center(
                  child: Text(
                    '内容: ' + content,
                    softWrap: true,
                    style: TextStyle(color: Colors.black, fontSize: 16),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
